﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Master.Master"
    Inherits="System.Web.Mvc.ViewPage<NewsViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form method="get" action="">
    <table class="table">
        <tr>
            <td>
                <div class="classifyId">
                    <ul class="dropdownlisttree">
                        <%= HtmlExtned.DropDownlist("ClassifyId", Model.ClassifyList, Convert.ToInt32(this.ViewContext.RouteData.Values["ClassifyId"]),true)%>
                    </ul>
                </div>
                关键字：<%=Html.TextBox("Key")%>
                <input type="submit" value="搜 索" />
            </td>
        </tr>
    </table>
    </form>
    <table class="table textCenter">
        <thead>
            <tr>
                <th class="textLeft">
                    标 题
                </th>
                <th class="width80">
                    类 别
                </th>
                <th class="width80">
                    作 者
                </th>
                <th class="width80">
                    ETag
                </th>
                <th class="width50">
                    有效性
                </th>
                <th class="width80">
                    时 间
                </th>
                <th class="width100">
                    操 作
                </th>
            </tr>
        </thead>
        <tbody>
            <%
                foreach (ENews news in Model.NewsList)
                {
            %>
            <tr>
                <td class="textLeft">
                    <%=news.Title%>
                </td>
                <td>
                    <%= Model.ClassifyList.FirstOrDefault(i=>i.ClassifyId == news.ClassifyId).Title %>
                </td>
                <td>
                    <%=news.Author%>
                </td>
                <td>
                    <%= news.ETag %>
                </td>
                <td>
                    <%=news.Isvalid ? "√" : "×"%>
                </td>
                <td class="width80">
                    <%=news.WriteTime %>
                </td>
                <td>
                    <%= Html.ActionLink("修 改", "Edit", "News", new { newsId=news.NewsId }, null)%>
                    <%=Html.Hidden("newsId", news.NewsId)%>
                    <input type="button" name="delete" value="删 除" />
                </td>
            </tr>
            <%
                }
            %></tbody>
        <tfoot>
            <tr>
                <td colspan="7">
                    <div class="divPager2">
                        <%= Html.Pager(ViewData["Pager"]) %>
                    </div>
                </td>
            </tr>
        </tfoot>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .classifyId
        {
            width: 270px;
            float: left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">

        $(function () {
            $(".classifyId > ul").dropdownlist();
            $(":button[name='delete']").click(function () {
                if (confirm("删除提示!\n确定要删除吗")) {
                    var newsId = $(this).parent().find(":hidden[name='newsId']").val();
                    $.post('<%=Url.Action("Delete") %>', { newsId: newsId }, function () { location.reload(); });
                }

            });
        });
    </script>
</asp:Content>
